//go:build wireinject

package main

import (
	"gitee.com/xiao_hange/go-admin-log/log/grpc"
	"gitee.com/xiao_hange/go-admin-log/log/ioc"
	"gitee.com/xiao_hange/go-admin-log/log/ioc/config"
	"gitee.com/xiao_hange/go-admin-log/log/repository"
	"gitee.com/xiao_hange/go-admin-log/log/repository/dao"
	"gitee.com/xiao_hange/go-admin-log/log/service"
	"github.com/google/wire"
)

var thirdPartySet = wire.NewSet(
	ioc.InitAppLogger,
	ioc.InitESClient,
)

var LogSvcProvider = wire.NewSet(
	service.NewLogService,
	repository.NewLogRepository,
	dao.NewLogElasticDAO,
)

func InitApp(sc *config.ServerConfig, ja *config.JaegerConfig, es *config.EsConfig) *App {
	wire.Build(
		LogSvcProvider,
		thirdPartySet,
		grpc.NewLogServiceServer,
		ioc.InitGrpcServer,
		wire.Struct(new(App), "*"),
	)
	return new(App)
}
